/**
 * @Author : andy.wangzhh
 * @Timestamp : 2016-06-25
 */
var deviceone = require("deviceone");
var app = deviceone.sm("do_App");
var global = deviceone.sm("do_Global");
var jpush = deviceone.sm("do_JPush");
var nf = deviceone.sm("do_Notification");

var buttonA = deviceone.mm("do_Animation", "BUTTONTOUCHDOWNS", "app");
buttonA.alpha({
    delay: 0,
    duration: 150,
    curve: "EaseInOut",
    repeatCount: "",
    autoReverse: true,
    fillAfter: false,
    alphaFrom: 1,
    alphaTo: 0.5
});
global.on("launch",function(data, e) {
	//deviceone.print("global的launch-"+JSON.stringify(data));
	//nf.alert("global的launch-"+JSON.stringify(data));
});
//接收到通知消息时触发
jpush.on("message",function(data, e) {
	//deviceone.print("收到通知-"+JSON.stringify(data));
	//nf.alert("收到通知-"+JSON.stringify(data));
});
//收到自定义消息并且应用在前台时触发
jpush.on("customMessage",function(data, e) {
	//deviceone.print("收到自定义-"+JSON.stringify(data));
	app.fire("firePushCustomMessage",data);
	//nf.alert("收到自定义-"+JSON.stringify(data));
});
//点击通知消息触发
jpush.on("messageClicked",function(data, e) {
	app.fire("firePushCustomMessage",data);
	//deviceone.print("点击通知-"+JSON.stringify(data));
	//nf.alert("点击通知-"+JSON.stringify(data));
});
//未连接时触发.杀死应用或者android调stop之后,都会触发didClose事件
jpush.on("didClose",function(data, e) {
	//deviceone.print("app退出或被杀死-"+JSON.stringify(data));
	//nf.alert("app退出或被杀死-"+JSON.stringify(data));
});
//已连接时触发.每次设备打开我们的app,连上极光 都会触发didConnect事件
jpush.on("didConnect",function(data, e) {
	//deviceone.print("app连接时-"+JSON.stringify(data));
	//nf.alert("app连接时-"+JSON.stringify(data));
});
//一个设备第一次接入极光后台时会触发didLogin事件,此时会返回设备的唯一RegistrationID
jpush.on("didLogin",function(data, e) {
	//deviceone.print("第一次接入-"+JSON.stringify(data));
	//nf.alert("第一次接入-"+JSON.stringify(data));
});

app.on("loaded", function () {
	app.openPage({source:"source://view/startup.ui",id:"qquan_page_start"});
});